/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author Cheng
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '/@/api/model/baseModel';

const { adminPath } = useGlobSetting();

export interface FaultManagement extends BasicModel<FaultManagement> {
  subjectId?: string; // 故障发生主体的ID
  subjectName?: string; // 故障发生主体的名称
  regionId?: number; // 区域ID
  regionName?: string; // 区域名称
  buildingId?: number; // 建筑ID
  buildingName?: string; // 建筑名称
  faultType?: string; // 故障类型，例：主机异常、编码不匹配等
  deviceId?: string; // 设备ID
  deviceName?: string; // 设备名称
  hostId?: string; // 所属主机ID
  hostName?: string; // 所属主机名称
  createTime?: string; // 记录创建时间
  updateTime?: string; // 记录最后更新时间
  recoveryImageId?: string; // 恢复正常图片的ID
  recoveryImageUrl?: string; // 恢复正常图片的URL
  handlerId?: string; // 处理人ID
  handlerName?: string; // 处理人姓名
  handlerContact?: string; // 处理人联系方式
  handlingMethod?: string; // 处理方式，例：更换主机、修复编码等
  isRecovered?: string; // 是否恢复，TRUE: 已恢复，FALSE: 未恢复
  completionStatus?: string; // TRUE: 已完成，FALSE: 未完成
}

export const faultManagementList = (params?: FaultManagement | any) =>
  defHttp.get<FaultManagement>({ url: adminPath + '/device/fault/faultManagement/list', params });

export const faultManagementListData = (params?: FaultManagement | any) =>
  defHttp.post<Page<FaultManagement>>({ url: adminPath + '/device/fault/faultManagement/listData', params });

export const faultManagementForm = (params?: FaultManagement | any) =>
  defHttp.get<FaultManagement>({ url: adminPath + '/device/fault/faultManagement/form', params });

export const faultManagementSave = (params?: any, data?: FaultManagement | any) =>
  defHttp.postJson<FaultManagement>({ url: adminPath + '/device/fault/faultManagement/save', params, data });

export const faultManagementDelete = (params?: FaultManagement | any) =>
  defHttp.get<FaultManagement>({ url: adminPath + '/device/fault/faultManagement/delete', params });
